import axios from "axios";

const qiniuTokenApi = 'https://2g59l88703.imdo.co/api/qiniu/getQiniuToken';
async function getQiniuToken() {
	try {
		const response = await axios.post(qiniuTokenApi);
		const data = response.data;
		if (response.status == 200) {
			return data.qiniu_token;
		} else {
			throw new Error(data.messages || "获取七牛云 token 失败")
		}
	} catch (e) {
		console.log('获取七牛云 token 失败', e);
		throw Error;
	}
}

export default getQiniuToken;